function Rotation(a) {
    this.set(a);
    this.aNtag = this.s.nTag;
    this.aMtag = this.s.mTag;
    this.aText = this.s.text;
    this.dis = Math.abs(this.s.slider.dis);
    this.sbj = this.s.slider.obj;
    this.dir = this.s.slider.dir || this.s.dir;
    this.Tween = this.s.slider.Tween || this.s.Tween;
    this.de = this.s.index;
    this.start = this.s.start;
    this.callBack = this.s.callBack;
    this.panelClass = this.s.panelClass;
    this.key = true;
    this.eType = ["click", "mouseover"];
    this.run()
}
Rotation.prototype = {version:4.01, B:function (c, a) {
    var b = Array.prototype.slice.call(arguments).slice(2);
    return function () {
        return a.apply(c, b)
    }
}, G:function (a) {
    return document.getElementById(a)
}, E:function (a, c) {
    for (var b in c) {
        a[b] = c[b]
    }
}, pre:function (a) {
    if (a.preventDefault) {
        a.preventDefault()
    } else {
        a.returnValue = false
    }
}, aE:function (b, c, a) {
    if (b.addEventListener) {
        b.addEventListener(c, a, false)
    } else {
        if (b.attachEvent) {
            b.attachEvent("on" + c, a)
        } else {
            b["on" + c] = a
        }
    }
}, set:function (a) {
    this.s = {evt:0, index:0, auto:[0, 2000], cur:"cur", panelClass:"", intTabTime:50, interval:500, nTag:[], mTag:[], text:[], slider:{obj:null, dis:0}, dir:"top", Tween:function (f, e, h, g) {
        return -h * ((f = f / g - 1) * f * f * f - 1) + e
    }, start:function () {
    }, callBack:function () {
    }};
    this.E(this.s, a || {})
}, action:function (a) {
    this.start();
    if (!this.key) {
        return false
    }
    this.TabLi(a);
    this.TabText(a);
    this.dis ? this.slider(a) : this.TabChange(a);
    this.callBack()
}, autoplay:function (a) {
    var b = this.aMtag.length || this.aNtag.length;
    if (a) {
        this.de = (this.de < b - 1) ? this.de + 1 : 0
    } else {
        this.de = (this.de != 0) ? this.de - 1 : b - 1
    }
    this.action(this.de)
}, autoFun:function () {
    this.clearAuto();
    this.intAuto = setInterval(this.B(this, this.autoplay, 1), this.s.auto[1])
}, clearAuto:function () {
    if (this.intAuto) {
        clearInterval(this.intAuto)
    }
}, TabLi:function (f) {
    if (this.aNtag != "") {
        var b = this.aNtag[f], e = "className", d = this.s.cur;
        if (this.lLi) {
            this.lLi[e] = this.lLi[e].replace(d, "");
            this.lLi.key = 0
        }
        if (b[e].indexOf(d) == -1) {
            b[e] += " " + d;
            b.key = 1
        }
        this.lLi = b
    }
}, TabText:function (a) {
    if (this.aText != "") {
        this.lText && (this.lText.style.display = "none");
        this.aText[a].style.display = "block";
        this.lText = this.aText[a]
    }
}, TabChange:function (c) {
    var b = this.s.panelClass;
    if (this.aMtag != "") {
        var a = this.aMtag[c];
        if (b) {
            if (this.lDiv && this.lDiv != a) {
                (this.lDiv.className.indexOf(b) == -1) && (this.lDiv.className += " " + b)
            }
            (this.aMtag[c].className.indexOf(b) != -1) && (this.aMtag[c].className = this.aMtag[c].className.replace(new RegExp("\\s*" + b, "g"), ""))
        } else {
            if (this.lDiv && this.lDiv != a) {
                this.lDiv.style.display = "none"
            }
            a.style.display = "block"
        }
        this.lDiv = a
    }
}, slider:function (a) {
    var j = this.sbj, f = this.dir, e = this.dis, g, l;
    if (e && !this.sliderInit) {
        j.style.position = "absolute";
        j.style[f] = -this.de * this.dis + "px";
        this.sliderInit = true
    }
    var m = 0, k = parseInt(this.sbj.style[f]), i = -a * e - k, h = this.s.interval;
    l = i > 0 ? "ceil" : "floor";
    this.Move = function () {
        m = new Date().getTime() - g;
        if (!i) {
            return false
        }
        if (this.moveTime) {
            clearTimeout(this.moveTime)
        }
        if (m < h) {
            j.style[f] = Math[l](this.Tween(m, k, i, h)) + "px";
            this.moveTime = setTimeout(this.B(this, this.Move), 10)
        } else {
            j.style[f] = k + i + "px"
        }
    };
    g = new Date().getTime();
    this.Move()
}, clearintTab:function () {
    if (this.intTab) {
        clearTimeout(this.intTab)
    }
}, aNtagAct:function (a) {
    if (this.lLi == a) {
        return false
    }
    this.clearintTab();
    this.clearAuto();
    this.intTab = setTimeout(this.B(this, function () {
        this.de = a.cNub;
        this.action(a.cNub)
    }), this.s.intTabTime);
    return this
}, run:function () {
    if (this.aNtag != "") {
        for (var g = 0, b = this.aNtag.length; g < b; g++) {
            var f = this.aNtag[g], c = f.getElementsByTagName("a")[0] || f.tagName.toLocaleLowerCase() == "a" && f;
            if (!f.cNub) {
                f.cNub = g
            }
            if (c) {
                this.aE(c, "focus", this.B(this, function (h) {
                    h.blur()
                }, c));
                if (this.s.evt == 0) {
                    this.aE(c, "click", this.pre)
                }
            }
            this.aE(f, this.eType[this.s.evt], this.B(this, function (h) {
                this.aNtagAct(h)
            }, f));
            if (this.s.auto[0] == 1) {
                this.aE(f, "mouseover", this.B(this, function (h) {
                    if (!h.key) {
                        return
                    }
                    this.clearAuto()
                }, f));
                this.aE(f, "mouseout", this.B(this, function (h) {
                    if (!h.key) {
                        return
                    }
                    this.autoFun();
                    this.clearintTab()
                }, f))
            } else {
                this.aE(f, "mouseout", this.B(this, this.clearintTab))
            }
        }
    }
    this.action(this.de);
    if (this.s.auto[0] == 1) {
        this.autoFun();
        var d = this.aMtag;
        if (d != "") {
            for (var a = 0, e = d.length; a < e; a++) {
                this.aE(d[a], "mouseover", this.B(this, this.clearAuto));
                this.aE(d[a], "mouseout", this.B(this, this.autoFun))
            }
        }
    }
}};
